package be.nepherte.movmanager.client.gui.components;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.DisclosurePanelImages;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;

/**
 * This class represents a disclosure panel header. It features an icon for every state of the DiclusurePanel widget (open and closed) and a title
 * header. This class is supposed to be used as the header argument for DisclosurePanel. The icons used for the open status and closed status are
 * disclosurePanelOpen.gif and disclosurePanelClosed.gif respectively.
 * <p>
 * This file is part of MovManager.
 * </p>
 * <p>
 * MovManager is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * </p>
 * <p>
 * MovManager is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * </p>
 * <p>
 * You should have received a copy of the GNU General Public License
 * along with MovManager.  If not, see <a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses</a>.
 * </p>
 * 
 * @author	Bart Verhoeven
 * @since	20/05/2009
 * @version	0.1
 */
public class DisclosurePanelHeader extends HorizontalPanel {
	/**An image provider to make images available for this disclosure panel header.*/
	private final DisclosurePanelImages images = (DisclosurePanelImages) GWT.create(DisclosurePanelImages.class);

	/**
	 * Create a header for a DisclosurePanel. This header consists of an icon  (one for an open and one for a closed disclosure panel) and a title.
	 * 
	 * @param	isOpen
	 * 			whether the disclose panel is initially open or closed
	 * @param 	html
	 * 			the title of the disclosure panel header.
	 */
	public DisclosurePanelHeader(boolean isOpen, String html) {
		add(isOpen ? images.disclosurePanelOpen().createImage() : images.disclosurePanelClosed().createImage());
		add(new HTML(html));
	}
}